package com.app.common.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.MissingResourceException;
import java.util.Properties;

public class CommonParamProperties {
	
	
	public Properties readProperties() {
		InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("SysConfig.properties");    
		  Properties p = new Properties();    
		  try {    
		   p.load(inputStream); 
		   inputStream.close();
		  } catch (IOException e1) {    
		   e1.printStackTrace();    
		 } 
		 return p;
	}
	
	public static String getParam(String key) {

		if (key == null || key.equals("") || key.equals("null")) {

			return "";

		}

		String result = "";

		try {
			Properties p = new CommonParamProperties().readProperties();
			result = StringUtil.parse2String(p.getProperty(key));
		} catch (MissingResourceException e) {

			e.printStackTrace();

		}

		return result;

	}
}
